package com.question.controller.user;

import com.question.pojo.entity.Major;
import com.question.pojo.result.Result;
import com.question.service.MajorService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/users/majors")
@Slf4j
@Api(tags = "专业相关接口")
public class UserMajorController {

    @Autowired
    private MajorService majorService;

    /**
     * 获取当前用户专业信息
     * @return
     */
    @GetMapping("/myinfo")
    @ApiOperation("获取当前用户专业信息")
    public Result<Major> getMajorById() {
        log.info("获取当前用户专业信息");
        Major major = majorService.getMajorByUserId();
        return Result.success(major);
    }
}